from http import HTTPStatus
from dashscope import Application


def call_agent_sensor(question):
    print(f"question: {question}")
    response = Application.call(app_id='2224361fc4c74eb09b16250d56ff76bf',
                                prompt=f'{question}',
                                api_key='sk-6f18b69180814f389c2c768d50290672', )

    if response.code != HTTPStatus.OK:
        print(
            'request_id=%s, code=%s, message=%s\n' % (response.request_id, response.status_code, response.output.text))
        return response.output.text
    else:
        return "查询失败。"
